import request from "../request/request";
import API from "../request/api";

export default {
  create(param) {
    return request.post(API.items, param);
  },
  getList(param) {
    return request.get(API.items, param);
  },
  delete(id) {
    return request.delete(API.item(id))
  },
  get(id) {
    return request.get(API.item(id))
  },
  update(id, itemForm) {
    return request.put(API.item(id), itemForm)
  },
  login(form) {
    return request.post(API.login, form)
  },
  getOrderList(param) {
    return request.get(API.orders, param);
  },
  getOrderDetails(id) {
    return request.get(API.order(id))
  },
  addCart(param){
    return request.post(API.cart, param)
  },
  getCart() {
    return request.get(API.cart)
  },
  clearCart() {
    return request.delete(API.cart)
  },
  addOrder() {
    return request.post(API.orders)
  },
  getOrderStatistic(){
    return request.get(API.statistic)
  }
}
